package com.chen.palmar.project.home;

import android.os.Bundle;
import android.widget.TextView;

import com.chen.palmar.R;
import com.chen.palmar.base.BaseActivity;
import com.chen.palmar.common.override.ListImageLoader;
import com.chen.palmar.common.widget.view.AutoToolbar;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;

import java.util.ArrayList;

import butterknife.Bind;

/**
 * @author Chen
 * @date 2018/1/19
 * 功能描述：
 */

public class ImageListActivity extends BaseActivity {
    @Bind(R.id.title_bar)
    TextView titleBar;
    @Bind(R.id.tool_bar)
    AutoToolbar toolBar;
    @Bind(R.id.banner_view)
    Banner bannerView;
    private ArrayList<String> info;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
    }

    @Override
    public void init() {
        titleBar.setText("查看图片");
        toolBar.setNavigationOnClickListener(v -> ImageListActivity.this.finish());

        info = getIntent().getStringArrayListExtra("info");
        //设置指示器位置（当banner模式中有指示器时）
        bannerView.setIndicatorGravity(BannerConfig.CENTER);
        bannerView.setImageLoader(new ListImageLoader());
        if (info != null) {
            bannerView.setImages(info);
            bannerView.start();
        }
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_image_list;
    }
}
